import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { TravelAccountVO, TravelAccountForm, TravelAccountQuery } from '@/pagesA/api/workflow/travelAccount/types';

/**
 * 查询差旅费报销单列表
 * @param query
 * @returns {*}
 */

export const listTravelAccount = (query?: TravelAccountQuery): AxiosPromise<TravelAccountVO[]> => {
  return request({
    url: '/workflow/travelAccount/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询差旅费报销单详细
 * @param id
 */
export const getTravelAccount = (id: string | number): AxiosPromise<TravelAccountVO> => {
  return request({
    url: '/workflow/travelAccount/' + id,
    method: 'get'
  });
};

/**
 * 新增差旅费报销单
 * @param data
 */
export const addTravelAccount = (data: TravelAccountForm) => {
  return request({
    url: '/workflow/travelAccount',
    method: 'post',
    data: data
  });
};

/**
 * 修改差旅费报销单
 * @param data
 */
export const updateTravelAccount = (data: TravelAccountForm) => {
  return request({
    url: '/workflow/travelAccount',
    method: 'put',
    data: data
  });
};

/**
 * 删除差旅费报销单
 * @param id
 */
export const delTravelAccount = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/travelAccount/' + id,
    method: 'delete'
  });
};
